<?php include_once($_SERVER['DOCUMENT_ROOT']."/controller/common/common_setting_unit.php"); ?>
<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <?php include_once("../controller/detail-list.php"); ?>
    <? include_once(ROOT_PATH_ . "/controller/common/module/head.php"); ?>

</head>






<body>

<div id="topbar">
<?php include '../../../modules/topbar.php'; ?>
</div>



<div id="container">
<!--Container端點01-->
<div id="maincontent" class="list">
<!--maincontent端點01-->



<div id="sidebar">
<?php include '../../../modules/sidebar.php'; ?>
</div>



<div id="content" class="list-box clearfix <? echo $system_part ?>">

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
    <legend><h1><? echo $plate['name'] ?></h1></legend>
    </fieldset>

    <div class="statistic">
       		<?php include_once("../../../modules/detail_btn.php");?>

            <div class="function">
                <div class="sort layui-form">
                    <div class="layui-form-item" style="margin-bottom:5px; display:inline-table">
                    <form class="layui-form">
                        <label class="layui-form-label">排序</label>
                        <div class="layui-input-block">
							<select lay-filter="MM_jumpMenu" >
                                <option <?php if($sortby == ''){echo 'selected="selected"';}?>  value="detail-list.php?nowpageid=<?php echo $nowpageid; ?>&nid=<? echo $trans_nid ?>&sortby=listorder&sys_part=<? echo $system_part ?>">排序选择</option>
                                <option <?php if($sortby == 'listorder' && $sortorder == 'desc'){echo 'selected="selected"';}?> value="detail-list.php?nowpageid=<?php echo $nowpageid; ?>&nid=<? echo $trans_nid ?>&sortby=listorder&sortorder=desc&sys_part=<? echo $system_part ?>">人工排序降序</option>
                                <option <?php if($sortby == 'listorder' && $sortorder == 'asc'){echo 'selected="selected"';}?> value="detail-list.php?nowpageid=<?php echo $nowpageid; ?>&nid=<? echo $trans_nid ?>&sortby=listorder&sortorder=asc&sys_part=<? echo $system_part ?>">人工排序升序</option>
                                <option <?php if($sortby == 'nid' && $sortorder == 'desc'){echo 'selected="selected"';}?> value="detail-list.php?nowpageid=<?php echo $nowpageid; ?>&nid=<? echo $trans_nid ?>&sortby=nid&sortorder=desc&sys_part=<? echo $system_part ?>">输入时间降序</option>
                                <option <?php if($sortby == 'nid' && $sortorder == 'asc'){echo 'selected="selected"';}?> value="detail-list.php?nowpageid=<?php echo $nowpageid; ?>&nid=<? echo $trans_nid ?>&sortby=nid&sortorder=asc&sys_part=<? echo $system_part ?>">输入时间升序</option>
                                <option <?php if($sortby == 'name' && $sortorder == 'desc'){echo 'selected="selected"';}?> value="detail-list.php?nowpageid=<?php echo $nowpageid; ?>&nid=<? echo $trans_nid ?>&sortby=name&sortorder=desc&sys_part=<? echo $system_part ?>">资料名称升序</option>
                                <option <?php if($sortby == 'name' && $sortorder == 'asc'){echo 'selected="selected"';}?> value="detail-list.php?nowpageid=<?php echo $nowpageid; ?>&nid=<? echo $trans_nid ?>&sortby=name&sortorder=asc&sys_part=<? echo $system_part ?>">资料名称降序</option>
                            </select>
						</div>
                    </form>
                    </div>

                </div>
            </div>
       <hr/>
    </div>
  <br class="clearfloat"/>





<div class="list-box <? echo $system_part ?>">

<div class="list-boxes">



    <table class="layui-table layui-form">
            <colgroup>
                <col width="20">
                <col width="150">
                <col>
                <col width="225"  class="publish_time"  style="display:none">
                <col width="105"  class="clickrate"     style="display:none">
                <col width="175" >
                <col width="100">
                <col width="180">
            </colgroup>
            <thead>
            <tr>
                <th> </th>
                <th>图片</th>
                <th>资料</th>
                <th class="publish_time" style="display:none">时间段</th>
                <th class="clickrate" style="display:none  ">点击/浏览</th>
                <th>排序</th>
                <th>发布</th>
                <th>操作</th>
            </tr>



            </thead>
            <tbody>

    <?php for ($i = 0; $i < $detailnum; $i++) {?>
				<tr id="item<?echo $detail[$i]['nid']?>">

            <td >
                <input type="checkbox" name="nid[]"
                       value="<?echo $detail[$i]['nid']?>"
                       lay-skin="primary"
                       lay-filter="nid-filter"
                >
            </td>



            <td><img src="/uploadfiles/<? echo $theme_folder ?>/<?php echo $detail[$i]['banner'] ?>" /></td>
            <td> <ul class="list-boxing-data">
                    <li class="title-name">
                        <h6 style="font-size: 18px"><label>名称：</label>
                        <a href="detail-edit.php?nid=<?php echo $detail[$i]['nid'] ?>&sys_part=<? echo $system_part ?>"
                            <? if ($detail[$i]['publish'] != 1) { echo "class='title-notice'"; } ?> >
                            <?php echo $detail[$i]['name'] ?>
                        </a>
                        </h6>
                    </li>



                    <li class="link">
                        <label>链接：</label>
                        <span class="target" style="display: none">
                            <? if($detail[$i]['target'] == "1")
                                    {
                                        $target_str="新窗口打开";
                                    }
                                else
                                    {
                                        $target_str="原窗口打开";
                                    }
                                ?>
                           (<?echo $target_str?>)
                        </span>

                       <?if (strlen($detail[$i]['link']) == 0) {
                            echo "暂无链接";
                        } else {
                            echo $detail[$i]['link'];
                        }
                        ?>

                    </li>


                    <br class="clearfloat"/>

                    <?
                    $banner_term_list=select_lines_items($table_Prefix."banner_term","","name,nid","publish =1","");
                    $banner_term_date=transform_2darray_in_1darray_with_new_key($banner_term_list,"nid","name");
                    ?>

                    <li class="term">
                        <label style="float:left;line-height:28px;">所属分类：</label>
                        <div style=" float:left; line-height:28px;">
                            /<? echo $term_name_list[$detail[$i]['banner_term']]?>
                       </div>
                    </li>




                </ul>
            </td>

                    <td class="publish_time" style="display:none">
                         开始：<? echo $detail_onsaletime[$i] ?><br/>
                         结束：<? echo $detail_offshelves[$i] ?>
                    </td>


                    <td class="clickrate" style="display:none">
                        <li >
                             <? echo $detail[$i]['clickrate'] ?> /
                             <? if(!$detail[$i]['views']){echo "0";}else{echo $detail[$i]['views'];} ?>
                        </li>
                    </td>

                    <td>

                        <li class="listorder bind-listorder">
                            <div class="addsub">
                                <div class="title">列表顺序</div>
                                <button type="button" class="btn-add">
                                    +
                                </button>
                                <input type="text" data-id="<?echo $detail[$i]['nid']?>"   class="input-counter"
                                       oninput="value=value.replace(/[^\d]/g,'')" value="<? echo $detail[$i]['listorder'] ?>">
                                <button type="button" class="btn-subtract">
                                    -
                                </button>
                            </div>


                        </li>


                    </td>


                    <td>
                        <li >
                            <input type="checkbox" name="publish" value="<?php echo $detail_publish[$i];?>"
                                   lay-skin="switch" lay-filter="filter"
                                   id="<?php echo $detail[$i]['nid'];?>"
                                   lay-text="发布|隐藏" <?if ($detail[$i]['publish'] == 1) { echo "checked"; }?> >
                        </li>
                    <td>

<div style="margin-bottom:15px;padding-bottom: 15px; ">


         <span
             onclick="deleter(<?php echo $detail[$i]['nid'] ?>,'data_delete')"
             class="layui-btn layui-btn-sm layui-btn-primary">
             <i class="layui-icon">&#xe640;</i>删除
        </span>


    <a href="detail-edit.php?nid=<?php echo $detail[$i]['nid'] ?>&sys_part=<? echo $system_part ?>&nowpageid=<? echo $_REQUEST['nowpageid'] ?>&sortby=<? echo $_REQUEST['sortby'] ?>&term_nid=<? echo $trans_nid ?>"
       class="modify layui-btn  layui-btn-sm" > <i class="layui-icon">&#xe642;</i> 修改</a>
</div>

                </td>



        </tr>
    <?php

    }
    ?>
			</tbody>
    </table>


</div>


    <?php include 'modules/page_numbers.php'; ?>




<!--list-box end-->
</div>

<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat" />
</div>
<!--container端點01-->
</div>

<script src="../assets/js/detail-list-update.js"></script>
<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?>



<script>
    //一般直接写在一个js文件中
    layui.use(['layer', 'form'], function(){
        var layer = layui.layer
            ,form = layui.form;


        form.on('switch(filter)', function(data){
            console.log(data.elem); //得到checkbox原始DOM对象
            console.log(data.elem.checked); //开关是否开启，true或者false
            console.log(data.value); //开关value值，也可以通过data.elem.value得到
            console.log(data.othis); //得到美化后的DOM对象

            updateSwitchStatus(data.elem.id,data.elem.name,data.elem.checked ? 1 : 0)
        });



    })


</script>



    </body>
</html>
